var a : Double = 1.1;
var b = 1e-5;
var pi = 3.1415926;
print(a);
print(b);

def mycos(var x : Double) : Double {
    if (x < 0.001) {
        var sq = x * x;
        var sum = 1.0 - sq / 2.0 + sq * sq / 24.0;
        return sum;
    }
    else {
        var t = mycos(x / 2.0);
        return 2.0 * t * t - 1.0;
    }
}

print(mycos(pi / 3.0));

def pow(var x : Double, var n:Int) {
    if (n == 0) {
        return 1.0;
    }
    if (n == 1) {
        return x;
    }
    var res = 1.0;
    if (n % 2 == 1) {
        return x * pow(x, n-1);
    }
    else {
        var t = pow(x, n / 2);
        return t * t;
    }
}

print(pow(2.0, 10));
